-- GENERATED SPELL FOR [Khit'rix the Dark Master] --


function spell0_31222(pUnit, Event) --@Mind Flay,n/a--
pUnit:FullCastSpellOnTarget(38243,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_31222', 3000, 1)
end

function spell1_31222(pUnit, Event) --@Psychic Scream,Self--
pUnit:FullCastSpellOnTarget(22884,pUnit)
pUnit:RegisterEvent('Sorts_31222', 4299, 1)
end

function spell2_31222(pUnit, Event) --@Summon Bone Spiders,n/a--
pUnit:FullCastSpellOnTarget(61055,pUnit:GetMainTank ())
pUnit:RegisterEvent('Sorts_31222', 2000, 1)
end

function Sorts_31222(pUnit, Event)
local choix_sorts_31222 = math.random(0, 2)
if choix_sorts_31222 == 0 then
pUnit:RegisterEvent('spell0_31222', 1, 1)
end
if choix_sorts_31222 == 1 then
pUnit:RegisterEvent('spell1_31222', 1, 1)
end
if choix_sorts_31222 == 2 then
pUnit:RegisterEvent('spell2_31222', 1, 1)
end
end

function mob31222_Action(pUnit, Event)
pUnit:RegisterEvent('Sorts_31222', math.random(1500, 3000), 1)
end

function mob31222_Leave(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob31222_Kill(pUnit, Event)
--pUnit:RemoveEvents();--
end

function mob31222_Die(pUnit, Event)
pUnit:RemoveEvents();
end

RegisterUnitEvent(31222, 1, 'mob31222_Action')
RegisterUnitEvent(31222, 2, 'mob31222_Leave')
RegisterUnitEvent(31222, 3, 'mob31222_Kill')
RegisterUnitEvent(31222, 4, 'mob31222_Die')
